<?php

namespace common\models\wechat;

use Yii;

/**
 * This is the model class for table "wechat_basic_reply".
 *
 * @property string $id
 * @property string $rid
 * @property string $content
 */
class WechatBasicReply extends \yii\db\ActiveRecord
{

    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '文字回复',      //用于修改了什么的显示
        'mainfield' => 'content',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];

    
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'wechat_basic_reply';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['rid', 'content'], 'required'],
            [['rid'], 'integer'],
            [['content'], 'string', 'max' => 1000],
            [['id'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'rule' => '规则名称',
            'keyword' => '关键字',
            'content' => '回复内容',
        ];
    }

    public function getRule()
    {
        return $this->hasOne(WechatReplyRule::className(),['id'=>'rid']);
    }

    public function getkeyword()
    {
        return $this->hasOne(WechatReplyKeyword::className(),['rid'=>'rid']);
    }
}
